What is @babel/plugin-syntax-decorators?
The @babel/plugin-syntax-decorators package is a plugin for Babel, a JavaScript compiler, that allows Babel to parse and understand decorator syntax. Decorators are a stage 2 proposal for JavaScript and provide a way to add annotations and a meta-programming syntax for class declarations and members. Decorators can be used to annotate and modify classes and properties at design time.
Parsing decorator syntax
This feature enables Babel to parse decorators, which are annotations placed directly above class declarations, methods, or properties. The code sample shows a simple decorator applied to a class.
@decorator
class MyClass {}
function decorator(target) {
// modify target
}